#include "comm.hpp"

int main()
{
    // 写管道信息
    int fd = open(PIPE_PATH, O_WRONLY); // 打开管道
    assert(fd != -1);
    std::cout << "--pipe w_open success!!--" << std::endl;

    while (true)
    {
        sleep(1);
        // 写管道文件
        std::string message;
        std::cout << "Please input message:";
        std::getline(std::cin, message);
        write(fd, message.c_str(), message.size());
        std::cout << "--pipe write success!!--" << std::endl;
    }
    close(fd); // 关闭管道文件

    return 0;
}